﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using DungeonCraft.DataModel.Abilities;

namespace DungeonCraft.DataModel
{
    public class HitDetector
    {
        public List<Player> hitables;
        public HitDetector()
        {
            hitables = new List<Player>();
        }

        public List<Player> detectHits(IDamageRectangle area)
        {
            List<Player> hits = new List<Player>();
            foreach (Player player in hitables)
            {
                Rectangle pArea = new Rectangle(player.Location.X, player.Location.Y, player.Width, player.Height);
                if(pArea.Intersects(area.getDamageField()))
                    hits.Add(player);
            }
            return hits;
        }
    }
}
